using System;
using System.Collections.Generic;
using System.Text;
using Core.Domain.Bases;

namespace Core.Domain.Entities
{
  ///<summary>
  ///</summary>
  public class Community : EntityBaseWithId
  {
    ///<summary></summary>
    public Community()
    {
      this.CreateIndependentInstances();
      People = new List<Person>();
    }

    private IndependentWrapper<string> _name;

    ///<summary>Name of the community</summary>
    public virtual string Name
    {
      get { return _name.Value; }
      set { _name.Value = value; }
    }

    private IndependentWrapper<IList<Person>> _people;

    ///<summary>Community members
    ///</summary>
    public virtual IList<Person> People
    {
      get { return _people.Value; }
      set { _people.Value = value; }
    }
  }

  ///<summary>Adders for this class</summary>
  public static partial class Extensions
  {
    ///<summary>Add a Person to this Community</summary>
    ///<param name="community"></param>
    ///<param name="person"></param>
    public static Community Add(this Community community, Person person)
    {
      person.Community = community;
      community.People.Add(person);
      return community;
    }


    
  }

}